package com.ljyyy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


/**
 * Redis如何实现排行榜？
 *
 * 1 新增数据
 *  zadd user:ranking 100 user1 200 user2 300 user3
 *
 * 2 查看数据，使用zrevrange命令（从高到低排序）或 zrange命令（从低到高排序）来获取排行榜的前几名
 *   2.1 zrange user:ranking 0 -1
 *   2.2 zrange user:ranking 0 -1 withscores 或者  zrevrange user:ranking 0 -1 withscores
 *   2.3 zrangebyscore user:ranking 100 1000 withscores
 *   2.4 zrandmember user:ranking 5 withscores
 *   2.5 # 获取用户积分排行榜前3名（分数从高到低）
 *       zrevrange user:ranking 0 2 WITHSCORES
 */
@SpringBootApplication
public class RankingListDemoApplication {
	public static void main(String[] args) {
		SpringApplication.run(RankingListDemoApplication.class, args);
	}

}
